import React, { Component } from 'react-native';

const {
  StyleSheet,
  View,
  Text,
  Image,
  Dimensions,
  Animated
} = React;

var WINDOW_WIDTH = Dimensions.get('window').width;

class splashScreen extends Component {
	constructor(props){
		super(props);
		this.state={
			bounceValue:new Animated.Value(1)
		}
	}
	componentDidMount(){
		this.state.bounceValue.setValue(1);
	    Animated.timing(
	      this.state.bounceValue,
	      {
	        toValue: 1.5,
	        duration: 5000,
	      }
	    ).start();
	}
	render() {
	    return (
	    	<View style={styles.contain}>
	    		<Animated.Image 
	    			style={[styles.backgroundPic,{transform: [{scale: this.state.bounceValue},]}]} 
	    			source={require('./img/background.jpg')}
	    		>
	    		</Animated.Image >
	    		<Text style={styles.text}>南牧智能母猪饲喂器APP{'\n'}伍明煜@20160422</Text>
	    	</View>
	      	
	    );
	}
}

var styles = StyleSheet.create({
	contain:{
		flex:1,
	},
	text:{
	    flex: 1,
	    fontSize: 16,
	    textAlign: 'center',
	    color: 'white',
	    position: 'absolute',
	    left: 0,
	    right: 0,
	    bottom: 30,
	    backgroundColor: 'transparent',
	},
	logo:{
        resizeMode: 'contain',
        //position: 'absolute',
        //bottom: 10,
        width: 300,
        //height:100,
        backgroundColor: 'transparent',
	},
	backgroundPic:{
		flex:1,
		//alignItems:'center',
		//justifyContent:'center',
		width:WINDOW_WIDTH, 
	},
});


export default splashScreen;
